import path from 'path';
import {defineConfig} from 'vite';
import vue from '@vitejs/plugin-vue';

export default defineConfig({
    plugins: [vue()],
    server: {
        port: 3000,
        open: true
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src'),
            '#': path.resolve(__dirname, 'public'),
            '~': path.resolve(__dirname, 'node_modules'),
            '@assets': path.resolve(__dirname, 'src/assets'),
            '@components': path.resolve(__dirname, 'src/components'),
            '@router': path.resolve(__dirname, 'src/router'),
            '@store': path.resolve(__dirname, 'src/store'),
            '@utils': path.resolve(__dirname, 'src/utils'),
            '@views': path.resolve(__dirname, 'src/views'),
            '@api': path.resolve(__dirname, 'src/api'),
            '@docs': path.resolve(__dirname, 'docs/.vuepress/dist'),
        }
    },
    envPrefix: ['VITE_'], // 确保只暴露以 VITE_ 开头的环境变量,
    base: './', // 基础路径
    publicDir: 'public', // 静态文件目录
});